<template>
  <div class="sm-sman-smanagementAllbGoods">
    <div class="smSmgAllgzbBox">
      <ul>
        <li v-for="(value, index) in gzbInfo" :class="{'active':nowPackageIndex==index}" :key="index" ref="smgAllgzbli">
          <p>
            工作包编码：<span style="margin-left: 3px">{{ value.PACKAGECODE }}</span>
          </p>
          <p>
            机型/批次/架次：<span style="margin-left: 3px">{{ value.PRODUCTNAME }}/{{ value.BATCHNO }}/{{ value.STARTPLANENO }}</span>
          </p>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
// 导入request模块
import { smSmgAllGzbInfo,queryAllAoByPacakgeCode } from "@/utils/api.js"
export default {
  name: "SortingManagementAllbGoods",
  data() {
    return {
      gzbInfo: [],
      nowAo:'',
      nowPackageIndex:0,
      nowAoINdex:0
    //   isMaterial:'未确认',
    };
  },
  methods: {
    //yebo 2023-07-25 查询工作包下的AO
    reloadPackageAo(){
      var para = {"packageId":this.gzbInfo[0].MSTASKPACKAGEID};
      console.log("重新加载工作包AO",para);
      queryAllAoByPacakgeCode(para).then((res)=>{this.$bus.$emit('initAoInfo',res.data.responseBody);});
    }
  },
  mounted() {
    // 直接展示所有工作包信息
      smSmgAllGzbInfo({
      }).then((res)=>{
          console.log('所有工作包信息',res)
          this.gzbInfo = res.data.responseBody.CurrentPackages
          console.log(this.gzbInfo)
          if(res.data.responseBody.msg){
            this.$Alert({
              title: "提示",
              message: res.data.responseBody.msg,
              type: "success",
            });
          }
          //yebo 更改初始化加载完工作包后，加载第一个工作包下所有ao
          if(this.gzbInfo.length==0){
            return ;
          }
          this.$options.methods.reloadPackageAo.bind(this)();
          var searchParams = this.gzbInfo[0];
          // 将工作包任务信息传递到 XGoodsInfo.vue界面中
          this.$bus.$emit('sendWorkPackageInfo', { searchParams })
      });
    }
}
</script>
<style scoped>
.sm-sman-smanagementAllbGoods {
  width: 100%;
}
.ssmSmgAllgzbBox {
  float: left;
  width: 100%;
  /* display: none; */
  /* height: 300px; */
  /* border: 1px solid black; */
  /* background: #3375d7; */
}
.smSmgAllgzbBox ul {
  display: flex;
  overflow-y: hidden;
  height: 100%;
}
.smSmgAllgzbBox ul li {
  flex: none;
  /* float: left; */
  /* padding: 0 10px; */
  width: 190px;
  /* height: 90%; */
  /* background-color: rgb(200, 244, 244); */
  background-color: #ffffff;
  /* background: #ffffff; */
  border: 1px solid #cccbcb;
  border-radius: 10%;
  /* box-shadow: inset 0px 0px 20px 0px #cccbcb; */
  margin-left: 1.8%;
  margin-top: 5px;
  font-size: 12px;
  /* text-align: center; */
}
/* .sm-sman-leftInfo ul li p:nth-child(1) {
  text-align: center;
} */
.smSmgAllgzbBox ul li p {
  margin-top: 3px;
  margin-left: 5px;
  width: calc(100% - 4px);
}
.active{
  background-color: rgb(140, 203, 255)!important;
  color:white;
}
</style>